﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.RandomNumberGenerator
{
	public class Exponential<T> : IRandomNumberGenerator<T>
	{
		public Exponential()
		{
			this.Lambda = DefaultValueProvider<T>.GetValueFromInteger(1);
		}
		public Exponential(T lambda)
		{
			this.Lambda = lambda;
		}
		public T Lambda { get; set; }
		public T Next()
		{
			return DynamicCastOperator.Divide<double, T, T>(-Math.Log(SingletonUniformRandomProvider.NextDouble()), Lambda);
		}
	}
}